<script type="text/javascript">
var paging = new function(){
	
	this.prePage = function(){
		var val = parseInt("${pageIndex}");
		if(val <= 1){
			val = 1;
		}else{
			val = val -1;;
		}
		paging.gotoPage(val);
	};
	
	this.nextPage = function(){
		var val = parseInt("${pageIndex}");
		var pageCount = parseInt( "${pageCount}");
		if(val >= pageCount){
			val = pageCount;
		}else{
			val = val + 1;
		}
		paging.gotoPage(val);
	};
	
	this.gotoPage = function(index){
		
		var iIndex = parseInt(index);
		var pageCount = parseInt( "${pageCount}");
		var $val = document.getElementById("pageIndex");
		
		if(isNaN(index) || iIndex < 1){
			$val.value =1;
		}else if(iIndex > pageCount){
			$val.value = pageCount;
		}else {
			$val.value = iIndex;
		}
		
		${function};
	};
}
</script>
<style>
	#paging{border: medium none;margin: 0 auto;width: auto;}
	#paging td {border: medium none;height: 18px;text-align: center;}
	#paging a{background-color: #EFEFEF;border-radius: 3px 3px 3px 3px; border: 1px solid #D0CDC9;color: #0066CC; text-decoration:none; display: block;font-size: 10px;height:12px; padding: 3px 8px;}
	#paging a:hover{background-color: #DFDFDF;border-radius: 3px 3px 3px 3px; border: 1px solid #D0CDC9;color: #E69303;text-decoration:none;display: block;font-size: 10px;height:12px; padding: 3px 8px;}
	#paging .disable{background-color: #EFEFEF;border-radius: 3px 3px 3px 3px; border: 1px solid #D0CDC9;color: #0066CC; text-decoration:none; display: block;font-size: 10px;height:12px; padding: 3px 8px;}
</style>
<div style="width:100%;height:30px">
	<table id="paging">
		<tbody>
			<tr>
				<td>
					<#if pageIndex <= 1>
						<span class="disable">上一页</span>
					<#else>
						<a onclick="paging.prePage()" href="javascript:void(0); " >上一页</a>
					</#if>
				</td>
				<td>
					<#if 1 == pageIndex>
						<a onclick="paging.gotoPage(1)" href="javascript:void(0);" >
							<strong>1</strong>
						</a>
					<#else>
						<a onclick="paging.gotoPage(1)" href="javascript:void(0);" >1</a>
					</#if>
				</td>
				<#if ((pageIndex-2) > 2) >
						<td>...</td>
				</#if>
				<#list (pageIndex-2)..(pageIndex+2) as p>
					<#if (p > 1 && p < pageCount)>
					<td>
					  <a onclick="paging.gotoPage(${p})" href="javascript:void(0);" >
						<#if p == pageIndex>
							<strong>${p}</strong>
						<#else>
							${p}
						</#if>
					  </a>
					</td>
					</#if>
				</#list>
				<#if ((pageIndex+2) < (pageCount-1)) >
						<td>...</td>
				</#if>
				<#if (pageCount > 1) >
					<td>
						<a onclick="paging.gotoPage(${pageCount})" href="javascript:void(0);" >
							<#if pageCount == pageIndex >
								<strong>${pageCount}</strong>
							<#else>
								${pageCount}
							</#if>
						</a>
					</td>
				</#if>
				<td>
					<#if (pageIndex >= pageCount)>
						<span class="disable">下一页</span>
					<#else>
						<a onclick="paging.nextPage()" href="javascript:void(0);" >下一页</a>
					</#if>
					</td>
			</tr>
		</tbody>
	</table>
	<input type="hidden" id ="pageIndex" name="pageIndex">
	<input type="hidden" id ="pageSize" name="pageSize" value="${pageSize}">
</div>